package com.feng.common.exception;

import com.feng.common.api.ResultCode;

/**
 * @author Feng
 * @since 2022/4/18 10:06
 */
public class BaseException extends RuntimeException {

    private final Integer code;

    private final String msg;

    public BaseException(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
    }

    public BaseException(String msg) {
        this.code = 500;
        this.msg = msg;
    }

    @Override
    public String getMessage() {
        return this.msg;
    }

    public Integer getCode() {
        return this.code;
    }
}
